﻿namespace Baddies.Utils
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;

    /// <summary>
    /// Utilities class.
    /// </summary>
    public class Util
    {
        /// <summary>
        /// 4 cardinal directions.
        /// </summary>
        public enum Dir 
        { 
            Up, 
            Down, 
            Left, 
            Right 
        }

        /// <summary>
        /// In a coordinate system with the 0,0 in the top left, it 
        /// calculates whether the given point is inside the rectangle.
        /// </summary>
        /// <param name="rect">Rectangle to check if it includes the point.</param>
        /// <param name="x">X coordinate of the point.</param>
        /// <param name="y">Y coordinate of the point.</param>
        /// <returns>True if inside the rectangle, false otherwise.</returns>
        public static bool PoinInRect(Rectangle rect, int x, int y)
        {
            bool inRect = true;

            if (x < rect.Left)
            {
                inRect = false;
            }
            else if (x > rect.Right)
            {
                inRect = false;
            }
            else if (y < rect.Top)
            {
                inRect = false;
            }
            else if (y > rect.Bottom)
            {
                inRect = false;
            }

            return inRect;
        }
    }
}
